import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ConSuppliesVO, ConSuppliesForm, ConSuppliesQuery } from '@/api/project/conSupplies/types';

/**
 * 查询合同供货内容列表
 * @param query
 * @returns {*}
 */

export const listConSupplies = (query?: ConSuppliesQuery): AxiosPromise<ConSuppliesVO[]> => {
  return request({
    url: '/project/conSupplies/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询合同供货内容详细
 * @param id
 */
export const getConSupplies = (id: string | number): AxiosPromise<ConSuppliesVO> => {
  return request({
    url: '/project/conSupplies/' + id,
    method: 'get'
  });
};

/**
 * 新增合同供货内容
 * @param data
 */
export const addConSupplies = (data: ConSuppliesForm) => {
  return request({
    url: '/project/conSupplies',
    method: 'post',
    data: data
  });
};

/**
 * 修改合同供货内容
 * @param data
 */
export const updateConSupplies = (data: ConSuppliesForm) => {
  return request({
    url: '/project/conSupplies',
    method: 'put',
    data: data
  });
};

/**
 * 删除合同供货内容
 * @param id
 */
export const delConSupplies = (id: string | number | Array<string | number>) => {
  return request({
    url: '/project/conSupplies/' + id,
    method: 'delete'
  });
};
